package com.usian.article.service.impl

import com.usian.article.mapper.ApArticleConfigMapper
import com.usian.article.mapper.ApArticleContentMapper
import com.usian.article.mapper.ApArticleMapper
import com.usian.article.service.ApArticleService
import com.usian.model.article.pojos.ApArticle
import com.usian.model.article.pojos.ApArticleConfig
import com.usian.model.article.pojos.ApArticleContent
import com.usian.model.base.BaseServiceImpl
import com.usian.model.common.dtos.ResponseResult
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Service

@Service
open class ApArticleServiceImpl :ApArticleService,BaseServiceImpl<ApArticleMapper,ApArticle>() {

    @Autowired
    private lateinit var article: ApArticleMapper

    @Autowired
    private lateinit var articleConfig: ApArticleConfigMapper

    @Autowired
    private lateinit var articleContent: ApArticleContentMapper

    @Value("\${file.url}")
    private lateinit var fileUrl:String


    override fun saveArticleConfig(apArticleConfig: ApArticleConfig?): ResponseResult<*> {
        val insert = articleConfig.insert(apArticleConfig)
        if (insert>0)return ResponseResult.okResult("success")
        return ResponseResult.errorResult("添加失败");
    }

    override fun saveArticleContent(apArticleContent: ApArticleContent?): ResponseResult<*> {
        articleContent.insert(apArticleContent)
        return ResponseResult.okResult("success")
    }


}